#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;

/*
int main() 
{
    int n;
    cin >> n;
    int *p = new int[n];
    for (int i = 0; i<n; i++)
        {
        cin >> p[i];
        }
    cout << (*min_element(p, p + n))<<' '<< (*max_element(p, p + n)) << endl;
    system("pause");
    return 0;
}
*/
int main() 
{
    int n;
    cin >> n;
    int p[n];
    for (int i = 0; i<n; i++)
        {
        cin >> p[i];
        }
    cout << (*min_element(p, p + n))<<' '<< (*max_element(p, p + n)) << endl;
    system("pause");
    return 0;
}
